package com.xbongbong.saas.model.impl;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateUtil;
import com.xbongbong.pro.domain.dao.ScoreScriptLogDao;
import com.xbongbong.pro.domain.entity.ScoreScriptLogEntity;
import com.xbongbong.saas.model.ScoreScriptLogModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @description:  评分规则
 * @Author: chunyang.qin
 * @date: 2020-11-27 17:37
 * @since v1.0
 */
@Service("scoreScriptLogModel")
public class ScoreScriptLogModelImpl implements ScoreScriptLogModel {

    @Resource
    private ScoreScriptLogDao ScoreScriptLogDao;

    @Override
    public Integer insert(ScoreScriptLogEntity entity) throws XbbException {
        long now = DateUtil.getNow();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        entity.setDel(0);
        return ScoreScriptLogDao.insert(entity);
    }

    @Override
    public Integer update(ScoreScriptLogEntity entity) throws XbbException {
        long now = DateUtil.getNow();
        entity.setUpdateTime(now);
        return ScoreScriptLogDao.update(entity);
    }

    @Override
    public List<ScoreScriptLogEntity> findEntitys(Map<String, Object> param) {
        return ScoreScriptLogDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return ScoreScriptLogDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public ScoreScriptLogEntity getByKey(Long key, String corpid) {
        return ScoreScriptLogDao.getByKey(key,corpid);
    }

    @Override
    public ScoreScriptLogEntity getByTriggerDateAndFormId(Long triggerDate, Long formId, String corpid) {
        return ScoreScriptLogDao.getByTriggerDateAndFormId(triggerDate,formId,corpid);
    }

    @Override
    public Integer deleteByKey(Long key, String corpid) {
        return ScoreScriptLogDao.deleteByKey(key,corpid);
    }
}
